export default function myExample(){
  return{
    //用于警告和错误是展示
    name:"my-example",
    //初始化hooks,只走一次
    options(opts){
      console.log("options",opts)
    },
    buildStart(){
      console.log("buildStart")
    },
    //vite特有钩子
    config(config){
        console.log("config",config)
        return {}
    },
    configResolved(rvConfig){
      console.log("configResolved",rvConfig)
    },
    configureServer(configureServer){
      console.log("configureServer", configureServer);
    },
    transformIndexHtml(html){
      console.log("transformIndexHtml", html);
      return html
    },


    resolvedIds(source){
      console.log("resolvedId",source)
      if(source==="virtual-module"){
        //返回source表示命中，vite不再询问其他插件处理改id请求
        return source
      }
      return null
    },
    load(id){
      console.log("load",id)
      if(id==="virtual-module"){
        return "this is virtual!!!"
      }
      //null -> 其他id继续处理
      return  null
    }
  }
}
